var fs = require('fs');
var path = require('path');
var rl = require('readline');

var fileName = path.resolve(__dirname, 'data.txt');
var readStream = fs.createReadStream(fileName);

var rl = rl.createInterface({
    input: readStream
});

readStream.on('data',function(chunk){
    console.log(chunk);
})

// rl.on('line', function (chunk) {
//     console.log(chunk);
//     console.log('------this line read ------');
// })

rl.on('close', function () {
    console.log('close');
})